#define SM_LIGHTTYPE_DIRECTIONALLIGHT
#define SM_FLOAT 1
#define SM_ESM 1
#define SM_DEPTHTEXTURE 0
#define SM_NORMALBIAS 0
#define SM_DIRECTIONINLIGHTDATA 1
#define SM_USEDISTANCE 0
#define SM_SOFTTRANSPARENTSHADOW 1
#define ALPHATEXTURE
#define ALPHATESTVALUE 0.4
#define UV1
#define NUM_BONE_INFLUENCERS 0
#define SHADER_NAME fragment:shadowMap
precision highp float;
float bayerDither2(vec2 _P) {return mod(2.0*_P.y+_P.x+1.0,4.0);
}
float bayerDither4(vec2 _P) {vec2 P1=mod(_P,2.0);
vec2 P2=floor(0.5*mod(_P,4.0));
return 4.0*bayerDither2(P1)+bayerDither2(P2);
}
float bayerDither8(vec2 _P) {vec2 P1=mod(_P,2.0);
vec2 P2=floor(0.5 *mod(_P,4.0));
vec2 P4=floor(0.25*mod(_P,8.0));
return 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);
}
uniform float softTransparentShadowSM;
varying float vDepthMetricSM;
uniform vec3 biasAndScaleSM;
uniform vec2 depthValuesSM;
varying vec2 vUV;
uniform sampler2D diffuseSampler;
#define CUSTOM_FRAGMENT_DEFINITIONS
void main(void)
{
float alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;
if (alphaFromAlphaTexture<ALPHATESTVALUE)
discard;
if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alphaFromAlphaTexture) discard;
float depthSM=vDepthMetricSM;
depthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);
gl_FragColor=vec4(depthSM,1.0,1.0,1.0);
return;
}